def is_prime(n):
    if n < 2:
        return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return True
def np(n):
    while True:
        n += 1
        if is_prime(n):
            return n
words = input().split()
ns = ""
for word in words:
    if word == "zero":
        ns += "0"
    elif word == "one":
        ns += "1"
    elif word == "two":
        ns += "2"
    elif word == "three":
        ns += "3"
    elif word == "four":
        ns += "4"
    elif word == "five":
        ns += "5"
    elif word == "six":
        ns += "6"
    elif word == "seven":
        ns += "7"
    elif word == "eight":
        ns += "8"
    elif word == "nine":
        ns += "9"
    elif word == '1' or word == '2' or word == '3' or word == '4' or word == '5' or word == '6' or word == '7' or word == '8' or word == '9':
        print('Wrong input')

n = int(ns)

npn = np(n)

print(npn)
